<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father {
            margin: 100px 0;
            width: 500px;
            height: 300px;
            border: 1px solid #000;
        }

        .son {
            width: 200px;
            height: 100px;
            background-color: pink;

            transition: all 0.5s;
        }

        .father:hover .son {
            transform: translate(100px, 50px);
        }




        .box {
            position: relative;
            width: 500px;
            height: 250px;
            border: 1px solid #000;
        }

        .box1 {
            position: absolute;

            width: 100px;
            height: 50px;
            background-color: pink;
            transition: all 0.5s;
        }

        .box:hover .box1 {
            left: 50%;
            top: 50%;
            transform: translate(50%, 50%);
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="son"></div>
    </div>

    <div class="box">
        <div class="box1"></div>
    </div>

</body>

</html>